
import Constants from '../constants/constants';
import * as userMock from '../mocks/user';

/**
 * 发送请求（模拟）
 */
export default async function request(url, option) {

    if (url === '/user/login' && option.method === 'POST') {
      return userMock.login();
    }
    else if (url === '/user' && option.method === 'GET') {
      return userMock.getList();
    }
    else if (url.indexOf('/user') >= 0 && option.method === 'DELETE') {
      return userMock.remove();
    }
    
    return { data: null, code: Constants.Code.INTERNAL_ERROR };
}